/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaPrincipal.java
 *
 * Created on 3/06/2011, 01:00:10 PM
 */
package ventana;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.swing.JOptionPane;
import javax.swing.Timer;

import movimiento.ElementosKeplerianos;
import movimiento.Satelite;
import numeros.Constantes;
import coordenadas.Posicion;
import fecha.FechaActual;


/**
 *
 * @author Iván
 */
public class VentanaPrincipal extends javax.swing.JFrame implements Runnable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int iIndice = 0;
	private ElementosKeplerianos ek;
	private ActionListener al;
	private Timer timer1;
	private Date hora;
	private SimpleDateFormat formato;
	private String patron;
	private final Font fFormatoFuente = new Font("Cambria Math",0,11);
	private int iTiempoSimulacionSegundos = 0;
	private int iTiempoSimulacionMinutos = 0;
	private int iTiempoSimulacionHoras = 0;
	Thread fThread = null;
	MiPanel miPanel = null;
	
	/** Creates new form VentanaPrincipal */
    public VentanaPrincipal() {
    	setTitle("SVPosition");
    	initComponents();
    	activarReloj();
    	setSize(1358, 770);
    }
    /** The thread loops to draw each frame of drop.**/
    public void run () {
      // Loop through animation frames
      while ( fThread != null){
         // Sleep 25msecs between frames
        try{ Thread.sleep (1000);
        } catch  (InterruptedException e) { }
        // Repaint drop panel for each new frame
        miPanel.repaint ();
        calculoCoordenadas();
      }
    } /// run

    public void activarReloj(){
        al = new ActionListener(){
        	public void actionPerformed(ActionEvent e){
        		onTimer();
        	}
        };
        timer1 = new Timer(1000,al);
        timer1.start();
        GregorianCalendar g = new GregorianCalendar();
        long horas = g.get(GregorianCalendar.HOUR);
        long mins = g.get(GregorianCalendar.MINUTE);
        
        lboReloj.setText(String.valueOf(horas + mins));
    }


    private void onTimer(){
    	hora = new Date();
    	patron = "hh:mm:ss";
    	
    	formato = new SimpleDateFormat(patron);
    	lboReloj.setText(formato.format(hora));
    }
   
 /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {
    	miPanel = new MiPanel(); 
        miPanel.setName("mipanel");
        jtpPestanias = new javax.swing.JTabbedPane();
        jtpPestanias.setName("pestañas");
        pnlCoordenadas = new javax.swing.JPanel();
        pnlCoordenadas.setName("panel coordenadas");
        pnlDatosEntrada = new javax.swing.JPanel();
        pnlDatosEntrada.setName("pnlDatosEntrada");
        lboLatitud = new javax.swing.JLabel();
        tboLatitud = new javax.swing.JTextField();
        lboLongitud = new javax.swing.JLabel();
        tboLongitud = new javax.swing.JTextField();
        lboAltura = new javax.swing.JLabel();
        tboAltura = new javax.swing.JTextField();
        lboTiempoSimulacion = new javax.swing.JLabel();
        tboTiempoSimulacion = new javax.swing.JTextField();
        cboTiempoSimulacion = new javax.swing.JComboBox();
        btoSimular = new javax.swing.JButton();
        jComboBox1 = new javax.swing.JComboBox();
        jComboBox2 = new javax.swing.JComboBox();
        pnlTiempo = new javax.swing.JPanel();
        lboReloj = new javax.swing.JLabel();
        pnlImagenMundo = new javax.swing.JPanel();
        pnlImagenMundo.setName("pnlImagenMundo");
        pnlCoordenadaCalculadas = new javax.swing.JPanel();
        pnlCoordenadaCalculadas.setName("pnlCoordenadaCalculadas");
        pnlObservador = new javax.swing.JPanel();
        pnlObservador.setName("pnlObservador");
        lboXObs = new javax.swing.JLabel();
        tboXObs = new javax.swing.JTextField();
        lboYObs = new javax.swing.JLabel();
        tboYObs = new javax.swing.JTextField();
        lboZObs = new javax.swing.JLabel();
        tboZObs = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        pnlEcuatoriales = new javax.swing.JPanel();
        pnlEcuatoriales.setName("pnlEcuatoriales");
        lboAscencionRecta = new javax.swing.JLabel();
        tboAscencionRecta = new javax.swing.JTextField();
        tboAscencionRecta.setName("tboAscencionRecta");
        lboDeclinacion = new javax.swing.JLabel();
        tboDeclinacion = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        pnlHorizontales = new javax.swing.JPanel();
        lboAzimutHz = new javax.swing.JLabel();
        tboAzimutHz = new javax.swing.JTextField();
        lboAlturaHz = new javax.swing.JLabel();
        tboAlturaHz = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        pnlSiderales = new javax.swing.JPanel();
        lboXSideral = new javax.swing.JLabel();
        tboXSideral = new javax.swing.JTextField();
        lboYSideral = new javax.swing.JLabel();
        tboYSideral = new javax.swing.JTextField();
        lboZSideral = new javax.swing.JLabel();
        tboZSideral = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        pnlEcuatorialesLocales = new javax.swing.JPanel();
        pnlEcuatorialesLocales.setName("pnlEcuatorialesLocales");
        lboAnguloHorario = new javax.swing.JLabel();
        tboAnguloHorario = new javax.swing.JTextField();
        tboAnguloHorario.setName("tboAnguloHorario");
        lboDeclinacionLocal = new javax.swing.JLabel();
        tboDeclinacionLocal = new javax.swing.JTextField();
        tboDeclinacionLocal.setName("tboDeclinacionLocal");
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        pnlSubsatelitales = new javax.swing.JPanel();
        lboLatitudSubSate = new javax.swing.JLabel();
        tboLatitudSubSate = new javax.swing.JTextField();
        lboLongitudSubSate = new javax.swing.JLabel();
        tboLongitudSubSate = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jPanel2 = new PanelDistri();
        pnlTLE = new javax.swing.JPanel();
        cmbTLE = new javax.swing.JComboBox();
        pnlCargueDatos = new javax.swing.JPanel();
        jmbBarraMenu = new javax.swing.JMenuBar();
        jmArchivo = new javax.swing.JMenu();
        jmAyuda = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("SatPosition"); // NOI18N

        jtpPestanias.setToolTipText("");
        jtpPestanias.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        pnlDatosEntrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos de Entrada"));
        pnlDatosEntrada.setFocusCycleRoot(true);
        pnlDatosEntrada.setPreferredSize(new java.awt.Dimension(276, 234));
        pnlDatosEntrada.setRequestFocusEnabled(false);

        lboLatitud.setText("Latitud");

        tboLatitud.setToolTipText("4.6578987");
        tboLatitud.setEnabled(false);
        tboLatitud.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tboLatitudActionPerformed(evt);
            }
        });

        lboLongitud.setText("Longitud");

        tboLongitud.setToolTipText("-74.768657");
        tboLongitud.setEnabled(false);

        lboAltura.setText("Altura");

        tboAltura.setToolTipText("2689.435678");
        tboAltura.setEnabled(false);

        btoSimular.setText("Ejecutar");
        btoSimular.setEnabled(false);
        btoSimular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btoSimularActionPerformed(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Norte", "Sur"}));

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Este", "Oeste"}));

        javax.swing.GroupLayout pnlDatosEntradaLayout = new javax.swing.GroupLayout(pnlDatosEntrada);
        pnlDatosEntrada.setLayout(pnlDatosEntradaLayout);
        pnlDatosEntradaLayout.setHorizontalGroup(
            pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosEntradaLayout.createSequentialGroup()
                .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDatosEntradaLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lboLatitud)
                            .addComponent(lboLongitud)
                            .addComponent(lboAltura))
                        .addGap(26, 26, 26)
                        .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(tboAltura)
                            .addComponent(tboLongitud)
                            .addComponent(tboLatitud, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlDatosEntradaLayout.createSequentialGroup()
                        .addGap(92, 92, 92)
                        .addComponent(btoSimular)))
                .addContainerGap(56, Short.MAX_VALUE)
                )
        );
        pnlDatosEntradaLayout.setVerticalGroup(
            pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosEntradaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboLatitud)
                    .addComponent(tboLatitud, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tboLongitud, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lboLongitud)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(pnlDatosEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboAltura)
                    .addComponent(tboAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(5, 5, 5)
                .addComponent(btoSimular)
                //.addContainerGap(20, Short.MAX_VALUE)
                )
        );

        pnlTiempo.setBorder(javax.swing.BorderFactory.createTitledBorder("Hora Actual"));
        
        lboReloj.setText("");
        lboReloj.setFont(new Font("Century Schoolbook", 0, 40));

        javax.swing.GroupLayout pnlTiempoLayout = new javax.swing.GroupLayout(pnlTiempo);
        pnlTiempo.setLayout(pnlTiempoLayout);
        pnlTiempoLayout.setHorizontalGroup(
            pnlTiempoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTiempoLayout.createSequentialGroup()
            		.addGap(63, 63, 63)
                    .addComponent(lboReloj)
                    .addContainerGap(98, Short.MAX_VALUE))
        );
        pnlTiempoLayout.setVerticalGroup(
            pnlTiempoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTiempoLayout.createSequentialGroup()
            		.addContainerGap()
                    .addComponent(lboReloj)
                    .addContainerGap(20, Short.MAX_VALUE))
        );

        pnlImagenMundo.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        pnlImagenMundo.setFocusCycleRoot(true);

        javax.swing.GroupLayout pnlImagenMundoLayout = new javax.swing.GroupLayout(pnlImagenMundo);
        pnlImagenMundo.setLayout(pnlImagenMundoLayout);
        pnlImagenMundoLayout.setHorizontalGroup(
            pnlImagenMundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 586, Short.MAX_VALUE)
        );
        pnlImagenMundoLayout.setVerticalGroup(
            pnlImagenMundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 379, Short.MAX_VALUE)
        );
        pnlImagenMundo.add( miPanel );
        pnlCoordenadaCalculadas.setBorder(javax.swing.BorderFactory.createTitledBorder("Coordenadas"));

        pnlObservador.setBorder(javax.swing.BorderFactory.createTitledBorder("Observador"));

        lboXObs.setText("X");
        
        tboXObs.setFont(this.fFormatoFuente);
        
        lboYObs.setText("Y");

        tboYObs.setFont(this.fFormatoFuente);
        
        lboZObs.setText("Z");

        jLabel1.setText("m");

        jLabel2.setText("m");

        jLabel3.setText("m");

        javax.swing.GroupLayout pnlObservadorLayout = new javax.swing.GroupLayout(pnlObservador);
        pnlObservador.setLayout(pnlObservadorLayout);
        pnlObservadorLayout.setHorizontalGroup(
            pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlObservadorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(pnlObservadorLayout.createSequentialGroup()
                        .addComponent(lboXObs)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tboXObs, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlObservadorLayout.createSequentialGroup()
                        .addComponent(lboYObs)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tboYObs))
                    .addGroup(pnlObservadorLayout.createSequentialGroup()
                        .addComponent(lboZObs)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tboZObs)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addContainerGap(85, Short.MAX_VALUE))
        );
        pnlObservadorLayout.setVerticalGroup(
            pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlObservadorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboXObs)
                    .addComponent(tboXObs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lboYObs)
                    .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tboYObs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)))
                .addGap(18, 18, 18)
                .addGroup(pnlObservadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboZObs)
                    .addComponent(tboZObs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlEcuatoriales.setBorder(javax.swing.BorderFactory.createTitledBorder("Ecuatoriales"));

        lboAscencionRecta.setText("Ascencion Recta");

        tboAscencionRecta.setFont(new java.awt.Font("Tahoma", 0, 10));

        lboDeclinacion.setText("Declinación");

        jLabel7.setText("rad");

        jLabel8.setText("rad");

        javax.swing.GroupLayout pnlEcuatorialesLayout = new javax.swing.GroupLayout(pnlEcuatoriales);
        pnlEcuatoriales.setLayout(pnlEcuatorialesLayout);
        pnlEcuatorialesLayout.setHorizontalGroup(
            pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEcuatorialesLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lboAscencionRecta)
                    .addComponent(lboDeclinacion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tboDeclinacion)
                    .addComponent(tboAscencionRecta, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)))
        );
        pnlEcuatorialesLayout.setVerticalGroup(
            pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEcuatorialesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboAscencionRecta)
                    .addComponent(tboAscencionRecta, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(pnlEcuatorialesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboDeclinacion)
                    .addComponent(tboDeclinacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        pnlHorizontales.setBorder(javax.swing.BorderFactory.createTitledBorder("Horizontales"));

        lboAzimutHz.setText("Azimut");

        lboAlturaHz.setText("Altura");

        jLabel11.setText("Deg");

        jLabel12.setText("Deg");

        javax.swing.GroupLayout pnlHorizontalesLayout = new javax.swing.GroupLayout(pnlHorizontales);
        pnlHorizontales.setLayout(pnlHorizontalesLayout);
        pnlHorizontalesLayout.setHorizontalGroup(
            pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHorizontalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lboAzimutHz)
                    .addComponent(lboAlturaHz))
                .addGap(37, 37, 37)
                .addGroup(pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tboAlturaHz)
                    .addComponent(tboAzimutHz, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        pnlHorizontalesLayout.setVerticalGroup(
            pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHorizontalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboAzimutHz)
                    .addComponent(tboAzimutHz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addGap(18, 18, 18)
                .addGroup(pnlHorizontalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboAlturaHz)
                    .addComponent(tboAlturaHz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        pnlSiderales.setBorder(javax.swing.BorderFactory.createTitledBorder("Siderales"));

        lboXSideral.setText("X");

        lboYSideral.setText("Y");

        lboZSideral.setText("Z");

        jLabel4.setText("m");

        jLabel5.setText("m");

        jLabel6.setText("m");

        javax.swing.GroupLayout pnlSideralesLayout = new javax.swing.GroupLayout(pnlSiderales);
        pnlSiderales.setLayout(pnlSideralesLayout);
        pnlSideralesLayout.setHorizontalGroup(
            pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSideralesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlSideralesLayout.createSequentialGroup()
                        .addComponent(lboXSideral)
                        .addGap(18, 18, 18)
                        .addComponent(tboXSideral, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE))
                    .addGroup(pnlSideralesLayout.createSequentialGroup()
                        .addComponent(lboYSideral)
                        .addGap(18, 18, 18)
                        .addComponent(tboYSideral, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE))
                    .addGroup(pnlSideralesLayout.createSequentialGroup()
                        .addComponent(lboZSideral)
                        .addGap(18, 18, 18)
                        .addComponent(tboZSideral, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel4)
                        .addComponent(jLabel5))
                    .addComponent(jLabel6))
                .addContainerGap())
        );
        pnlSideralesLayout.setVerticalGroup(
            pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSideralesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboXSideral)
                    .addComponent(tboXSideral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addGap(18, 18, 18)
                .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboYSideral)
                    .addComponent(tboYSideral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addGap(18, 18, 18)
                .addGroup(pnlSideralesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboZSideral)
                    .addComponent(tboZSideral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pnlEcuatorialesLocales.setBorder(javax.swing.BorderFactory.createTitledBorder("Ecuatoriales Locales"));

        lboAnguloHorario.setText("Ángulo Horario");

        tboAnguloHorario.setFont(new java.awt.Font("Tahoma", 0, 10));

        lboDeclinacionLocal.setText("Declinación");

        tboDeclinacionLocal.setFont(new java.awt.Font("Tahoma", 0, 10));

        jLabel9.setText("rad");

        jLabel10.setText("rad");

        javax.swing.GroupLayout pnlEcuatorialesLocalesLayout = new javax.swing.GroupLayout(pnlEcuatorialesLocales);
        pnlEcuatorialesLocales.setLayout(pnlEcuatorialesLocalesLayout);
        pnlEcuatorialesLocalesLayout.setHorizontalGroup(
            pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEcuatorialesLocalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lboAnguloHorario)
                    .addComponent(lboDeclinacionLocal))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(tboDeclinacionLocal, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
                    .addComponent(tboAnguloHorario, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9))
                .addContainerGap())
        );
        pnlEcuatorialesLocalesLayout.setVerticalGroup(
            pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEcuatorialesLocalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboAnguloHorario)
                    .addComponent(tboAnguloHorario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lboDeclinacionLocal)
                    .addGroup(pnlEcuatorialesLocalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tboDeclinacionLocal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel10)))
                .addContainerGap(29, Short.MAX_VALUE))
        );

        pnlSubsatelitales.setBorder(javax.swing.BorderFactory.createTitledBorder("SubSatelitales"));

        lboLatitudSubSate.setText("Latitud");

        lboLongitudSubSate.setText("Longitud");

        jLabel13.setText("Deg");

        jLabel14.setText("Deg");

        javax.swing.GroupLayout pnlSubsatelitalesLayout = new javax.swing.GroupLayout(pnlSubsatelitales);
        pnlSubsatelitales.setLayout(pnlSubsatelitalesLayout);
        pnlSubsatelitalesLayout.setHorizontalGroup(
            pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSubsatelitalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lboLatitudSubSate)
                    .addComponent(lboLongitudSubSate))
                .addGap(51, 51, 51)
                .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tboLongitudSubSate, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
                    .addComponent(tboLatitudSubSate, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14))
                .addContainerGap())
        );
        pnlSubsatelitalesLayout.setVerticalGroup(
            pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSubsatelitalesLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lboLatitudSubSate)
                    .addComponent(tboLatitudSubSate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addGap(18, 18, 18)
                .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lboLongitudSubSate)
                    .addGroup(pnlSubsatelitalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tboLongitudSubSate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14))))
        );

        jLabel15.setText("Universidad Distrital Francisco Jose de Caldas");

        jLabel16.setText("Ingeniería Catastral y Geodesia");

        jLabel17.setText("Autores ");

        jLabel18.setText("Ivan Cabrales");

        jLabel19.setText("Manuel Aguilar");

        jLabel20.setText("Freddy Bedoya");

        jLabel21.setText("Eduardo Fuentes");

        jLabel22.setText("Jimmy Melo");

        jLabel23.setText("Tutor");

        jLabel24.setText("Ing Miguel Ávila");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(99, 99, 99)
                        .addComponent(jLabel16))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(71, 71, 71)
                        .addComponent(jLabel15)))
                .addContainerGap(20, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel17)
                    .addComponent(jLabel18)
                    .addComponent(jLabel19)
                    .addComponent(jLabel20)
                    .addComponent(jLabel22)
                    .addComponent(jLabel21))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel23)
                    .addComponent(jLabel24))
                .addContainerGap(36, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel15)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel16)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jLabel24))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel20)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel22)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addComponent(jLabel21))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        //jPanel2.
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 131, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 156, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout pnlCoordenadaCalculadasLayout = new javax.swing.GroupLayout(pnlCoordenadaCalculadas);
        pnlCoordenadaCalculadas.setLayout(pnlCoordenadaCalculadasLayout);
        pnlCoordenadaCalculadasLayout.setHorizontalGroup(
            pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                        .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(pnlObservador, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(pnlEcuatoriales, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlCoordenadaCalculadasLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(pnlHorizontales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(10, 10, 10)
                        .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(pnlSubsatelitales, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pnlEcuatorialesLocales, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pnlSiderales, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        pnlCoordenadaCalculadasLayout.setVerticalGroup(
            pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                        .addComponent(pnlSiderales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(pnlEcuatorialesLocales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(pnlSubsatelitales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlCoordenadaCalculadasLayout.createSequentialGroup()
                        .addComponent(pnlObservador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnlEcuatoriales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(pnlHorizontales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(pnlCoordenadaCalculadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        pnlTLE.setBorder(javax.swing.BorderFactory.createTitledBorder("Selección Satelite"));

        cmbTLE.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione uno", "AAU CUBESAT", "DTUSAT", "CUBESAT XI-IV" }));
        cmbTLE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbTLEActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlTLELayout = new javax.swing.GroupLayout(pnlTLE);
        pnlTLE.setLayout(pnlTLELayout);
        pnlTLELayout.setHorizontalGroup(
            pnlTLELayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTLELayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(cmbTLE, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(94, Short.MAX_VALUE))
        );
        pnlTLELayout.setVerticalGroup(
            pnlTLELayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTLELayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cmbTLE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(40, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlCoordenadasLayout = new javax.swing.GroupLayout(pnlCoordenadas);
        pnlCoordenadas.setLayout(pnlCoordenadasLayout);
        pnlCoordenadasLayout.setHorizontalGroup(
            pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                        .addComponent(pnlDatosEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addGroup(pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                                .addComponent(pnlTiempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(pnlTLE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(38, 38, 38))
                    .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                        .addComponent(pnlImagenMundo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(pnlCoordenadaCalculadas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlCoordenadasLayout.setVerticalGroup(
            pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pnlCoordenadaCalculadas, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlCoordenadasLayout.createSequentialGroup()
                        .addGroup(pnlCoordenadasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlCoordenadasLayout.createSequentialGroup()
                                .addComponent(pnlTLE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(pnlTiempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(pnlDatosEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnlImagenMundo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jtpPestanias.addTab("Coordenadas", null, pnlCoordenadas, "Cálculo Coordenadas");

        javax.swing.GroupLayout pnlCargueDatosLayout = new javax.swing.GroupLayout(pnlCargueDatos);
        pnlCargueDatos.setLayout(pnlCargueDatosLayout);
        pnlCargueDatosLayout.setHorizontalGroup(
            pnlCargueDatosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1303, Short.MAX_VALUE)
        );
        pnlCargueDatosLayout.setVerticalGroup(
            pnlCargueDatosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 646, Short.MAX_VALUE)
        );

        jtpPestanias.addTab("Cargue", null, pnlCargueDatos, "Cargue Datos desde Archivo");

        jmArchivo.setText("Archivo");
        jmbBarraMenu.add(jmArchivo);

        jmAyuda.setText("Ayuda");
        jmbBarraMenu.add(jmAyuda);

        setJMenuBar(jmbBarraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtpPestanias, javax.swing.GroupLayout.DEFAULT_SIZE, 1308, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtpPestanias, javax.swing.GroupLayout.DEFAULT_SIZE, 674, Short.MAX_VALUE)
                .addContainerGap())
        );

        jtpPestanias.getAccessibleContext().setAccessibleName("tbCoordendas");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tboLatitudActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tboLatitudActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tboLatitudActionPerformed

    private void btoSimularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btoSimularActionPerformed
        // TODO add your handling code here:
    	int iMinutosIteracion = 0;
    	int iMinutosActuales = 0;
    	calculoCoordenadas();
    	FechaActual faFechaIteracion = new FechaActual();
    	iMinutosIteracion = faFechaIteracion.getiMinutos() + 5;
    	iMinutosActuales = faFechaIteracion.getiMinutos();
    	if(iMinutosIteracion == iMinutosActuales){
    		clean();
    		calculoCoordenadas();
    		iMinutosIteracion += 5;
    	}
    	start();
    	
    }//GEN-LAST:event_btoSimularActionPerformed
    /** Start when browser is loaded or button pushed. **/
    public void start () {
      // If the thread reference not null then a
      // thread is already running. Otherwise, create
      // a thread and start it.
      if (fThread == null){
          fThread = new Thread (this);
          fThread.start ();
      }
    } // start
    
    /**
     * This method is to calculate the coordinates.
     * Is called to btoSimularActionPerformed method 
     */
    private void calculoCoordenadas(){    	
    	ek = new ElementosKeplerianos(iIndice);
    	Satelite sSat = new Satelite();
    	sSat.setdFrecuencia(ek.getdMovimientoMedio());
    	sSat.setdRapidezAngular();
    	sSat.setA();
    	ek.setdSemiEjeMayor(sSat.getA());
    	double dLat = Double.valueOf(this.tboLatitud.getText());
    	double dLon = Double.valueOf(this.tboLongitud.getText());
    	double dAlt = Double.valueOf(this.tboAltura.getText());
    	Posicion pPosicion = new Posicion(dLat, dLon, dAlt);
    	
    	//Radio curvatura
    	pPosicion.setdRadioCurvatura(Constantes.aWGS84);
    	
    	//Coordendas XYZ Geodesicas Observador
    	pPosicion.setdXGeodesicaObservador();
    	pPosicion.setdYGeodesicaObservador();
    	pPosicion.setdZGeodesicaObservador(Constantes.eWGS84);
    	
    	//Pasar a las cajas de texto
    	this.tboXObs.setText(String.valueOf(pPosicion.getdXGeodesicaObservador()));
    	this.tboYObs.setText(String.valueOf(pPosicion.getdYGeodesicaObservador()));
    	this.tboZObs.setText(String.valueOf(pPosicion.getdZGeodesicaObservador()));
    	
    	//coordendas Siderales
    	pPosicion.setdCoordXSatOrbita();
    	pPosicion.setdCoordYSatOrbita();
    	pPosicion.setdCoordZSatOrbita();
    	pPosicion.setdTriplaCoordSiderales(ek.getdAR(), ek.getdArgumentoPerigeo(), ek.getdInclinacion());
    	pPosicion.setdXSideral();
    	pPosicion.setdYSideral();
    	pPosicion.setdZSideral();
    	
    	//pasar a las cajas de texto
    	this.tboXSideral.setText(String.valueOf(pPosicion.getdXSideral()));
    	this.tboYSideral.setText(String.valueOf(pPosicion.getdYSideral()));
    	this.tboZSideral.setText(String.valueOf(pPosicion.getdZSideral()));
    	
    	//coordenadas Ecuatoriales
    	pPosicion.setdAnguloHorario(ek.getdAR());
    	pPosicion.setdDeclinacionEcuador(ek.getdInclinacion(), ek.getdArgumentoPerigeo(), ek.getdAR());
    	
    	//pasar a las cajas de texto
    	this.tboAnguloHorario.setText(String.valueOf(pPosicion.getdAnguloHorario()));
    	this.tboDeclinacionLocal.setText(String.valueOf(pPosicion.getdDeclinacionEcuador()));
    	this.tboAscencionRecta.setText(String.valueOf(ek.getdAR()));
    	this.tboDeclinacion.setText(String.valueOf(pPosicion.getdDeclinacionEcuador()));
    	
    	//coordenadas Topocentricas
    	pPosicion.setdXTopocentrico();
    	pPosicion.setdYTopocentrico();
    	pPosicion.setdZTopocentrico();
    	pPosicion.setdRadioTopcentrico();
    	
    	//coordendas Subsatelitales
    	pPosicion.setdLatitudSubsat();
    	pPosicion.setdLongitudSubsat();
    	
    	//pasar a las cajas de texto
    	this.tboLatitudSubSate.setText(String.valueOf(pPosicion.getdLatitudSubsat()));
    	this.tboLongitudSubSate.setText(String.valueOf(pPosicion.getdLongitudSubsat()));
    	
    	//coorddenadas Locales
    	
    	pPosicion.setdElevacion();
    	pPosicion.setdAzimut();

    	//pasar a las cajas de texto
    	this.tboAlturaHz.setText(String.valueOf(pPosicion.getdElevacion()));
    	this.tboAzimutHz.setText(String.valueOf(pPosicion.getdAzimut()));

    	
    }

    /**
     * This method is to clear the text containt 
     * into the text box of application
     */
    private void clean(){
    	this.tboAltura.setText("");
    	this.tboAlturaHz.setText("");
    	this.tboAnguloHorario.setText("");
    	this.tboAscencionRecta.setText("");
    	this.tboAzimutHz.setText("");
    	this.tboDeclinacion.setText("");
    	this.tboDeclinacionLocal.setText("");
    	this.tboLatitud.setText("");
    	this.tboLatitudSubSate.setText("");
    	this.tboLongitud.setText("");
    	this.tboLongitudSubSate.setText("");
    	this.tboTiempoSimulacion.setText("");
    	this.tboXObs.setText("");
    	this.tboXSideral.setText("");
    	this.tboYObs.setText("");
    	this.tboYSideral.setText("");
    	this.tboZObs.setText("");
    	this.tboZSideral.setText("");
    }

    
    /**
     * This method make the action on SVN
     * selected 
     * 
     * @param evt
     */
   private void cmbTLEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTLEActionPerformed
        // TODO add your handling code here:
        if(!this.cmbTLE.getSelectedItem().equals("Seleccione uno")){
            this.tboLatitud.setEnabled(true);
            this.tboLongitud.setEnabled(true);
            this.tboAltura.setEnabled(true);
            this.btoSimular.setEnabled(true);
            this.cboTiempoSimulacion.setEnabled(true);
            this.tboTiempoSimulacion.setEnabled(true);
        }
        else{
            this.tboLatitud.setEnabled(false);
            this.tboLongitud.setEnabled(false);
            this.tboAltura.setEnabled(false);
            this.btoSimular.setEnabled(false);
            this.cboTiempoSimulacion.setEnabled(false);
            this.tboTiempoSimulacion.setEnabled(false);            
        }
        if(this.cmbTLE.getSelectedItem().equals("AAU CUBESAT")){
        	iIndice = 1;
        	clean();
        }else if(this.cmbTLE.getSelectedItem().equals("DTUSAT")){
        	iIndice = 2;
        	clean();
        }else if(this.cmbTLE.getSelectedItem().equals("CUBESAT XI-IV")){
        	iIndice = 3;
        	clean();
        }
    }//GEN-LAST:event_cmbTLEActionPerformed

   private void cboTiempoSimulacionActionPerformed(ActionEvent evt) {
	   try{
		   if(cboTiempoSimulacion.getSelectedItem().equals("Segundos")){
			   iTiempoSimulacionSegundos = Integer.valueOf(this.tboTiempoSimulacion.getText());
			   //while((this.tboLatitud.equals("") && this.tboLongitud.equals(""))&& this.tboAltura.equals("")){
				   //this.btoSimular.setEnabled(true);	   
			   //}
			   
		   }else if(cboTiempoSimulacion.getSelectedItem().equals("Minutos")){
			   iTiempoSimulacionMinutos = Integer.valueOf(this.tboTiempoSimulacion.getText());
			   /*while((this.tboLatitud.equals("") && this.tboLongitud.equals(""))&& this.tboAltura.equals("")){
				   this.btoSimular.setEnabled(true);
			   }*/
		   }else if(cboTiempoSimulacion.getSelectedItem().equals("Horas")){
		   		iTiempoSimulacionHoras = Integer.valueOf(this.tboTiempoSimulacion.getText());
				   /*while((this.tboLatitud.equals("") && this.tboLongitud.equals(""))&& this.tboAltura.equals("")){
					   this.btoSimular.setEnabled(true);
				   }*/
		   }
	   }
	   catch(NumberFormatException e){
		   JOptionPane.showMessageDialog(null, "Debe Ingresar un numero en el tiempo de simulación");
	   }
   }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new VentanaPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    
    
    
    private javax.swing.JButton btoSimular;
    private javax.swing.JComboBox cboTiempoSimulacion;
    private javax.swing.JComboBox cmbTLE;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JMenu jmArchivo;
    private javax.swing.JMenu jmAyuda;
    private javax.swing.JMenuBar jmbBarraMenu;
    private javax.swing.JTabbedPane jtpPestanias;
    private javax.swing.JLabel lboAltura;
    private javax.swing.JLabel lboAlturaHz;
    private javax.swing.JLabel lboAnguloHorario;
    private javax.swing.JLabel lboAscencionRecta;
    private javax.swing.JLabel lboAzimutHz;
    private javax.swing.JLabel lboDeclinacion;
    private javax.swing.JLabel lboDeclinacionLocal;
    private javax.swing.JLabel lboLatitud;
    private javax.swing.JLabel lboLatitudSubSate;
    private javax.swing.JLabel lboLongitud;
    private javax.swing.JLabel lboLongitudSubSate;
    private javax.swing.JLabel lboReloj;
    private javax.swing.JLabel lboTiempoSimulacion;
    private javax.swing.JLabel lboXObs;
    private javax.swing.JLabel lboXSideral;
    private javax.swing.JLabel lboYObs;
    private javax.swing.JLabel lboYSideral;
    private javax.swing.JLabel lboZObs;
    private javax.swing.JLabel lboUnidadesX;
    private javax.swing.JLabel lboUnidadesY;
    private javax.swing.JLabel lboUnidadesZ;
    private javax.swing.JLabel lboZSideral;
    private javax.swing.JPanel pnlCargueDatos;
    private javax.swing.JPanel pnlCoordenadaCalculadas;
    private javax.swing.JPanel pnlCoordenadas;
    private javax.swing.JPanel pnlDatosEntrada;
    private javax.swing.JPanel pnlEcuatoriales;
    private javax.swing.JPanel pnlEcuatorialesLocales;
    private javax.swing.JPanel pnlHorizontales;
    private javax.swing.JPanel pnlImagenMundo;
    private javax.swing.JPanel pnlObservador;
    private javax.swing.JPanel pnlSiderales;
    private javax.swing.JPanel pnlSubsatelitales;
    private javax.swing.JPanel pnlTLE;
    private javax.swing.JPanel pnlTiempo;
    private javax.swing.JTextField tboAltura;
    private javax.swing.JTextField tboAlturaHz;
    private javax.swing.JTextField tboAnguloHorario;
    private javax.swing.JTextField tboAscencionRecta;
    private javax.swing.JTextField tboAzimutHz;
    private javax.swing.JTextField tboDeclinacion;
    private javax.swing.JTextField tboDeclinacionLocal;
    private javax.swing.JTextField tboLatitud;
    private javax.swing.JTextField tboLatitudSubSate;
    private javax.swing.JTextField tboLongitud;
    private javax.swing.JTextField tboLongitudSubSate;
    private javax.swing.JTextField tboTiempoSimulacion;
    private javax.swing.JTextField tboXObs;
    private javax.swing.JTextField tboXSideral;
    private javax.swing.JTextField tboYObs;
    private javax.swing.JTextField tboYSideral;
    private javax.swing.JTextField tboZObs;
    private javax.swing.JTextField tboZSideral;
    // End of variables declaration//GEN-END:variables
}
